package com.leeyu.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ItemStockController {

    private static int STOCK = 10;

    @RequestMapping("/decr")
    public void decr(){
        STOCK--;
        if (STOCK < 0){
            throw new RuntimeException("商品库存不足！");
        }
        System.out.println("扣除商品库存成功！");
    }
}
